package com.it.szcp.controller;


import cn.hutool.core.map.MapUtil;
import com.it.szcp.common.R;
import com.it.szcp.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 用户表 前端控制器
 * @author 黄锦洋
 * @since 2023-03-19
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 小程序登录接口
     * @param code wx.login获取的code
     * @return token信息
     */
    @PostMapping("/login")
    public R<Map<String,String>> login(String code){
        return R.ok(MapUtil.of("token",userService.login(code)));
    }

}

